Skip to content

fix: sentry profile lifecycle switch for controlplane#2251

Merged
miklosbarabas merged 3 commits intomainfrom
miklos/fix-sentry-profile-lifecycle-switch
Oct 2, 2025
Merged

fix: sentry profile lifecycle switch for controlplane#2251
miklosbarabas merged 3 commits intomainfrom
miklos/fix-sentry-profile-lifecycle-switch

Conversation

@miklosbarabas
Copy link
Copy Markdown
Contributor

@miklosbarabas miklosbarabas commented Sep 30, 2025

Summary by CodeRabbit

  • New Features

    • Added support to control Sentry profiling lifecycle via a new setting with options "manual" or "trace" (defaults to "manual").
    • The setting can be configured through environment variables and is applied during Sentry initialization.
  • Documentation

    • Updated example environment file to include the new Sentry profiling lifecycle variable.

Checklist

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Sep 30, 2025

Walkthrough

Adds a new SENTRY_PROFILE_LIFECYCLE environment variable, validates it in the env schema (enum "manual"|"trace" with default "manual"), exposes it on the Sentry config type, and passes it into Sentry.init; also updates the example .env.

Changes

Cohort / File(s) Summary
Sentry env schema & runtime wiring
controlplane/src/core/env.schema.ts, controlplane/src/index.ts, controlplane/src/core/sentry.config.ts
Adds SENTRY_PROFILE_LIFECYCLE to parsed env vars (z.enum(['manual','trace']).optional().default('manual')), adds `profileLifecycle?: 'manual'
Environment example update
controlplane/.env.example
Adds SENTRY_PROFILE_LIFECYCLE placeholder under the Sentry section.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title “fix: sentry profile lifecycle switch for controlplane” succinctly describes the introduction of a switch for controlling Sentry’s profiling lifecycle in the controlplane module. It directly references the primary change without unnecessary details or file lists, and it follows the Conventional Commits style expected by the repository guidelines. The phrasing is clear, concise, and specific enough for collaborators to understand the purpose of the pull request at a glance.
✨ Finishing touches
  • 📝 Generate Docstrings

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3ce023a and 69b379f.

📒 Files selected for processing (2)
  • controlplane/src/core/env.schema.ts (1 hunks)
  • controlplane/src/core/sentry.config.ts (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • controlplane/src/core/sentry.config.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: build_test
  • GitHub Check: Analyze (go)
🔇 Additional comments (1)
controlplane/src/core/env.schema.ts (1)

206-206: LGTM: SENTRY_PROFILE_LIFECYCLE enum correct

The enum values 'manual' and 'trace' align with the Sentry Node.js SDK’s profileLifecycle options.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🧪 Early access (Sonnet 4.5): enabled

We are currently testing the Sonnet 4.5 model, which is expected to improve code review quality. However, this model may lead to increased noise levels in the review comments. Please disable the early access features if the noise level causes any inconvenience.

Note:

  • Public repositories are always opted into early access features.
  • You can enable or disable early access features from the CodeRabbit UI or by updating the CodeRabbit configuration file.

Comment @coderabbitai help to get the list of available commands and usage tips.

@miklosbarabas miklosbarabas changed the title fix: Sentry profile lifecycle switch for controlplane fix: sentry profile lifecycle switch for controlplane Sep 30, 2025
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
controlplane/.env.example (1)

85-85: Remove quotes from the value and consider reordering.

The value "manual" should not be quoted in .env files unless the quotes are intended to be part of the value itself. Additionally, for consistency with the alphabetical ordering of other SENTRY_PROFILE_* variables, this line should come before SENTRY_PROFILE_SESSION_SAMPLE_RATE.

Apply this diff:

 SENTRY_TRACES_SAMPLE_RATE="1.0"
-SENTRY_PROFILE_SESSION_SAMPLE_RATE="1.0"
-SENTRY_PROFILE_LIFECYCLE="manual"
+SENTRY_PROFILE_LIFECYCLE=manual
+SENTRY_PROFILE_SESSION_SAMPLE_RATE="1.0"
 SENTRY_EVENT_LOOP_BLOCK_THRESHOLD_MS="100"

Based on static analysis hints.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 146f4ac and 3ce023a.

📒 Files selected for processing (4)
  • controlplane/.env.example (1 hunks)
  • controlplane/src/core/env.schema.ts (1 hunks)
  • controlplane/src/core/sentry.config.ts (2 hunks)
  • controlplane/src/index.ts (2 hunks)
🧰 Additional context used
🪛 dotenv-linter (3.3.0)
controlplane/.env.example

[warning] 85-85: [QuoteCharacter] The value has quote characters (', ")

(QuoteCharacter)


[warning] 85-85: [UnorderedKey] The SENTRY_PROFILE_LIFECYCLE key should go before the SENTRY_PROFILE_SESSION_SAMPLE_RATE key

(UnorderedKey)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: build_push_image
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Analyze (go)
🔇 Additional comments (5)
controlplane/src/core/env.schema.ts (1)

206-206: LGTM!

The schema validation correctly defines the enum with valid values ["manual", "trace"] and sets an appropriate default of "manual". This aligns with the Sentry SDK's expected values for profileLifecycle.

controlplane/src/core/sentry.config.ts (2)

13-13: LGTM!

The type definition correctly matches the enum values from the schema and follows the same pattern as other optional Sentry configuration fields.


30-30: LGTM!

The profileLifecycle value is correctly passed through to Sentry.init, maintaining consistency with other configuration options.

controlplane/src/index.ts (2)

76-76: LGTM!

The environment variable is correctly destructured from the parsed environment variables, following the same pattern as other Sentry configuration variables.


191-191: LGTM!

The profileLifecycle value is correctly propagated from the environment variable to the Sentry configuration, completing the end-to-end flow for this feature.

@miklosbarabas miklosbarabas enabled auto-merge (squash) September 30, 2025 12:29
Copy link
Copy Markdown
Contributor

@wilsonrivera wilsonrivera left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@miklosbarabas miklosbarabas merged commit ba7b94f into main Oct 2, 2025
9 checks passed
@miklosbarabas miklosbarabas deleted the miklos/fix-sentry-profile-lifecycle-switch branch October 2, 2025 12:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants